<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全选表</title>
</head>
<body>
    <table width="500px" border = 1 align="center">
        <thead>
            <tr>
                <th><input type="checkbox" class="selectall"></th>
                <th>商品</th>
                <th>价格</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><input type="checkbox" class = "selectone"></td>
                <td>Apple</td>
                <td>8000</td>
            </tr>
            <tr>
                <td><input type="checkbox" class="selectone"></td>
                <td>Huawei</td>
                <td>6000</td>
            </tr>
            <tr>
                <td><input type="checkbox" class="selectone"></td>
                <td>Xiaomi</td>
                <td>2000</td>
            </tr>
            <tr>
                <td><input type="checkbox" class="selectone"></td>
                <td>VIVO</td>
                <td>1500</td>
            </tr>
        </tbody>
    </table>

    <script>
        document.onkeyup = function(e){
            console.log('keyup');
        };

        document.onkeypress = function(e){
            console.log('keypress');
        };

        document.onkeydown = function(e){
            console.log('keydown');
        }
    </script>
</body>
</html>